package 对象之继承.demo01;

public class text {
    public static void main(String[] args) {
        Animal animal = new Animal();
        animal.eat();

        Animal animal1 = new Dog();
        animal1.eat();
        if (animal instanceof Dog)       //判断animal是否是Dog类的对象
        {
            Dog dog = (Dog) animal;
            dog.watch();
        }
    }
}
